﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Marbles.Web.Admin.Downloads
{
    /// <summary>
    /// Summary description for Backup
    /// </summary>
    public class Backup : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string siteid = context.Request.Params["id"];
            if (string.IsNullOrEmpty(siteid)) { return; }
            Core.Content.Sites.SiteDefinition site = Core.Content.Sites.SiteDefinition.GetSiteBySiteId(siteid);
            if (site == null) { return; }

            Marbles.Core.Site.Backup backup = new Core.Site.Backup(site);
            backup.Save(context.Response, site.SiteName);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}